package com.hbnu.list;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;

public class ListIteratorDemo {
    public static void main(String[] args) {
        List<String> arrayList = new ArrayList<>();

        arrayList.add("John");
        arrayList.add("Wick");
        arrayList.add("moon");
        arrayList.add("element");

        ListIterator<String> iterator = arrayList.listIterator();
        while(iterator.hasNext()){
            System.out.println(iterator.previousIndex()+"::"+iterator.next()+"::"+iterator.nextIndex());
        }

        System.out.println("++++++++++++++++++++++++++++++++++++++");
        while (iterator.hasPrevious()){
            System.out.println();
        }

    }
}
